package com.example.modules.dictionary;

import com.example.generator.mapper.DictionaryMapper;
import com.example.generator.model.Dictionary;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
@Slf4j
@AllArgsConstructor
public class DictionaryService {
    DictionaryMapper dictionaryMapper;

    public Map<String, List<Dictionary>> resolveDictionary() {
        List<Dictionary> dictionaries = dictionaryMapper.selectAll();
        return dictionaries.stream().collect(Collectors.groupingBy(Dictionary::getType));
    }
}
